﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using FluentNHibernate.Mapping;

namespace Barry.BarbeSystem.Models
{
    public class BarberDetail
    {
        [Key]
        public virtual int Id { set; get; }

        /// <summary>
        /// 项目详情
        /// </summary>
        [MaxLength(50)]
        [Display(Name = "理发项目名称")]
        [Required(ErrorMessage = "请填写理发项目的名称。")]
        public virtual string Name { set; get; }

        [Display(Name="价格(元)")]
        [Range(typeof(decimal),"0","5000000")]
        [Required(ErrorMessage = "请填写价格")]
        public virtual decimal Money { set; get; }

        public virtual BarberCategory BarberCategory { set; get; }
    }


    public class BarberDetailMap : ClassMap<BarberDetail>
    {
        public BarberDetailMap()
        {
            Id(i => i.Id);
            Map(i => i.Name).Length(50).Not.Nullable();
            Map(i => i.Money).Precision(7).Scale(2).Not.Nullable();
            References<BarberCategory>(i => i.BarberCategory);

        }
    }

    public class BarberDetailPageRequest : PageRequest
    {

        public string category { set; get; }

        public string detail { set; get; }
    }

}